package com.zls.commonutil;

import android.util.Log;

/**
 * Created by oop on 2018/4/4.
 */

public class Lg {

    private static boolean open = true;

    public static void setOpen(boolean open) {
        Lg.open = open;
    }

    public static void i(String tag, Object ... args){

        if(!open){
            return;
        }

        if(args.length > 0){
            for (Object o : args){
                Log.i(tag, o.toString());
            }
        }

    }

    public static void i(){

        if(!open){
            return;
        }

        StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
        StackTraceElement ste = stackTrace[3];
        String fileName = ste.getFileName();
        String methodName = ste.getMethodName();
        String lineNum = "" + ste.getLineNumber();

        i("executing", "file " + fileName + ", method " + methodName + ", line " + lineNum);

    }

}
